import Vue from 'vue'
// import Vuex from 'vuex'
import Login from '@/views/Login'
import VueRouter from 'vue-router'

import Layout from '../views/Layout/index.vue'
import Home from '../views/Layout/Home/index.vue'
import User from '../views/Layout/User/index.vue'
import Search from '@/views/Search'
import SearchResultList from '@/views/Search/ResultList'
// import ArticleItem from '../views/Layout/Home/components/Articleltem.vue'
import Article from '@/views/Article/id'
Vue.use(VueRouter)
// 添加路由规则
const routes = [
  {
    path: '/',
    redirect: '/layout'
  },
  {
    path: '/login',
    component: Login
  }, {
    path: '/layout',
    component: Layout,
    // 默认显示
    redirect: '/layout/home',
    // 增加二级路径
    children: [
      {
        path: 'home',
        component: Home
      }, {
        path: 'user',
        component: User
      },
      // 搜索页面
      {
        path: '/search',
        component: Search
      }]
  }, // 搜索结果页面
  {
    path: '/search/:keyword',
    component: SearchResultList
  }, {
    path: '/article',
    component: Article
  }
]

const router = new VueRouter({
  routes
})

export default router
